package com.springboot.demo.extend;

import org.springframework.beans.BeanUtils;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Exce {
    public static void main(String[] args) throws Exception, InvocationTargetException, InstantiationException, IllegalAccessException {

        Class<Child> childClass = Child.class;
        getclass(childClass).doGet();
        Child child = new Child();
        child.service();
    }


    public static  <T> T getclass(Class<T> clazz) throws Exception{
        Constructor<T> constructor = clazz.getConstructor(String.class);
        T o = constructor.newInstance("str");
        return o;
    }
}
